Skip to content

Track the amount spent on fees as payments are retried #1142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 27, 2021

Conversation

TheBlueMatt
Copy link
Collaborator

Especially once we merge the InvoicePayer logic soon, we'll want
to expose the total fee paid in the PaymentSent event.

@TheBlueMatt TheBlueMatt added this to the 0.0.103 milestone Oct 26, 2021
@codecov
Copy link

codecov bot commented Oct 27, 2021

Codecov Report

Merging #1142 (ce7da23) into main (59659d3) will decrease coverage by 0.00%.
The diff coverage is 96.15%.

❗ Current head ce7da23 differs from pull request most recent head 04d4a8f. Consider uploading reports for the commit 04d4a8f to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1142      +/-   ##
==========================================
- Coverage   90.51%   90.51%   -0.01%     
==========================================
  Files          69       69              
  Lines       35865    35891      +26     
==========================================
+ Hits        32462    32485      +23     
- Misses       3403     3406       +3     
Impacted Files Coverage Δ
lightning/src/util/events.rs 33.33% <25.00%> (ø)
lightning-invoice/src/payment.rs 92.83% <100.00%> (ø)
lightning/src/ln/chanmon_update_fail_tests.rs 97.65% <100.00%> (ø)
lightning/src/ln/channelmanager.rs 84.09% <100.00%> (+0.06%) ⬆️
lightning/src/ln/functional_test_utils.rs 95.14% <100.00%> (+0.02%) ⬆️
lightning/src/ln/functional_tests.rs 97.35% <100.00%> (-0.02%) ⬇️
lightning/src/ln/payment_tests.rs 99.10% <100.00%> (+<0.01%) ⬆️
lightning/src/ln/shutdown_tests.rs 95.89% <100.00%> (ø)
lightning/src/routing/router.rs 95.55% <100.00%> (+<0.01%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 59659d3...04d4a8f. Read the comment docs.

@@ -3464,21 +3484,22 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
// restart.
// TODO: We should have a second monitor event that informs us of payments
// irrevocably fulfilled.
payment.get_mut().remove(&session_priv_bytes, Some(path.last().unwrap().fee_msat));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the last two params here should be None for consistency.

I think it'd be a little more readable if we dropped the lock then called finalize_claims rather than duplicating the finalize_claims logic

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These actually should diverge more, see the TODO here - we'd really like to mark the payment fulfilled but not remove the HTLC until after the commitment signed dance completes.

Copy link
Contributor

@valentinewallace valentinewallace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty much ACK besides these last comments

@@ -436,6 +436,8 @@ pub(crate) enum PendingOutboundPayment {
payment_hash: PaymentHash,
payment_secret: Option<PaymentSecret>,
pending_amt_msat: u64,
/// Used to track the fee paid. Only present if the payment was serialized on 0.0.103+.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggested wording: "Used to track the fees from paths that have not yet succeeded or failed."

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm? No, we use it to track the full fees, we just do that by only tracking the pending fees and then deciding that's the fees actually paid when we succeed, since it will be unless someone gave us free money.

@TheBlueMatt
Copy link
Collaborator Author

Rebased on main and added the refactors requested, had to redo git history, though, so no fixup commits, sorry.

This will make the next commit much simpler
Especially once we merge the `InvoicePayer` logic soon, we'll want
to expose the total fee paid in the `PaymentSent` event.
@TheBlueMatt
Copy link
Collaborator Author

Squashed without diff, will land after CI:

$ git diff-tree -U1 ce7da235a 04d4a8f83
$

@TheBlueMatt TheBlueMatt merged commit 6f002ea into lightningdevkit:main Oct 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants